home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / yerk / mps231ss.hqx / Mops source / More classes / StringArray < prev    next >
Text File  |  1992-05-16  |  892b  |  53 lines

  1. \ StringArray - MRH May 86.
  2.  
  3. \ This class adds suitable indexed methods to the class Bytestring.
  4.  
  5. need    bytestring
  6.  
  7. :class  STRINGARRAY    super{  bytestring  array  }
  8.  
  9.     int    CURRENT
  10.  
  11. :m CURRENT:
  12.     get: current  ;m
  13.  
  14. :m (SEL):  { idx -- }
  15.     idx  put: current
  16.     idx ^elem4 @  ^base !
  17.     nil?: self  ?EXIT
  18.     ^base  size: handle  put: size  ;m
  19.  
  20. :m SELECT:  { idx -- }
  21.     idx (sel): self
  22.     nil?: self
  23.     IF        \ new: not done - do it now
  24.         new: super
  25.         handle: self  idx ^elem4 !
  26.     ELSE
  27.         reset: self
  28.     THEN  ;m
  29.  
  30. :m NEW:  ;m        \ Not needed now, as select: does it if necessary.
  31.  
  32. :m RELEASE:
  33.     limit 0 DO
  34.         i (sel): self  release: super    \ Harmless if not open
  35.         nilH  i ^elem4 !
  36.     LOOP  ;m
  37.  
  38. :m CLEARALL:
  39.     limit 0 DO
  40.         i (sel): self
  41.         handle: self  IF  clear: super  THEN
  42.     LOOP  ;m
  43.  
  44. :m DUMP:
  45.     ." Current:"  get: current  .  cr
  46.     dump: super  ;m
  47.  
  48. :m CLASSINIT:
  49.     idxbase  limit 4*  bounds
  50.     DO  nilH  i !  4 +LOOP  ;m
  51.  
  52. ;class
  53.